﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Business.Entities
{
    /// <summary>
    /// Represents a reason to why a specific sync action is performed
    /// </summary>
    public class SyncReason
    {
        private DateTime _googleDate;
        private DateTime _outlookDate;
        private bool _timeCompReason;
        private string _reasonString;

        /// <summary>
        /// Gives a reason based on time stamp comparison
        /// </summary>
        /// <param name="googleDate"></param>
        /// <param name="outlookDate"></param>
        public SyncReason(DateTime googleDate, DateTime outlookDate)
        {
            _timeCompReason = true;
            _googleDate = googleDate;
            _outlookDate = outlookDate;
        }

        /// <summary>
        /// Gives a textual reason
        /// </summary>
        /// <param name="reason"></param>
        public SyncReason(string reason)
        {
            _reasonString = reason;
        }

        public override string ToString()
        {
            if (_timeCompReason)
            {
                return String.Format("Google @ {0:r}, Outlook @ {1:r}", _googleDate, _outlookDate);
            }
            else return _reasonString;
        }
    }
}
